/**
 * Created by jack on 2018/2/27.
 */
$.get("../../" + "sys/dept/select", function(r){
    debugger
    r.deptList.forEach(function(value){
        var con=  $('#groupField').val();
        if(con){
            con=con.substring(9,con.length-2);
        }
        if(con==value.deptId){
            $('#groupField').append('<option selected value="'+value.deptId+'">'+value.name+'</option>');
        }
        else{
            $('#groupField').append('<option  value="'+value.deptId+'">'+value.name+'</option>');
        }

    });
})


$.get("../../" + "sys/user/alllist", function(r){
    $('#assigneeField').append('<option  value="${applyUserId}">申请人</option>');
    r.page.forEach(function(value){
        var con=  $('#assigneeField').val();

        if(con){
            con=con.substring(9,con.length-2);
        }
        if(con==value.userId){
            $('#assigneeField').append('<option selected value="'+value.userId+'">'+value.nickName+'</option>');
        }
        else{
            $('#assigneeField').append('<option  value="'+value.userId+'">'+value.nickName+'</option>');
        }

    });
})


$.get("../../" + "sys/user/alllist", function(r){
    $('#userField').append('<option  value="${applyUserId}">申请人</option>');
    r.page.forEach(function(value){

        var con=  $('#userField').val();

        if(con){
            con=con.substring(9,con.length-2);
        }
        if(con==value.userId){
            $('#userField').append('<option selected value="'+value.userId+'">'+value.nickName+'</option>');
        }
        else{
            $('#userField').append('<option  value="'+value.userId+'">'+value.nickName+'</option>');
        }

    });
})

/* var Select = {
 del : function(obj,e){
 if((e.keyCode||e.which||e.charCode) == 8){
 var opt = obj.options[0];
 opt.text = opt.value = opt.value.substring(0, opt.value.length>0?opt.value.length-1:0);
 }
 },
 write : function(obj,e){
 if((e.keyCode||e.which||e.charCode) == 8)return ;
 var opt = obj.options[0];
 opt.selected = "selected";
 opt.text = opt.value += String.fromCharCode(e.charCode||e.which||e.keyCode);
 }
 }*/
